import KoaRouter from 'koa-router';
import PageController from '../controllers/page.js';

const pageRouter = new KoaRouter({
    prefix: '/api/page'
});

pageRouter.get('/:pageId', async function (ctx) {
    const pageId = ctx.params.pageId
    const data = await new PageController().page(pageId);
    ctx.body = {
        data,
        message: 'ok'
    };
});

pageRouter.get('/:projectId', async function (ctx) {
    const projectId = +ctx.params.projectId;
    const data = await new PageController().pages(projectId);
    ctx.body = {
        data,
        message: 'ok'
    };
});

export default pageRouter
